package com.ntschy.bt.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;


/**
 * @author ymj
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum BtDeclareStatusEnum implements IEnum<Integer> {
    /**
     * 状态 1-待发布 2-已发布
     */
    TO_BE_PUBLISHED(1, "待发布"),

    PUBLISHED(2, "已发布");

    private final int value;

    private final String desc;

    BtDeclareStatusEnum(int value, String desc){
        this.value = value;
        this.desc = desc;
    }
    @Override
    public Integer getValue() {
        return this.value;
    }

    public String getDesc(){
        return desc;
    }

    @JsonCreator
    public static BtDeclareStatusEnum getBtDeclareStatusFromValue(int value){
        for(BtDeclareStatusEnum declareStatus : BtDeclareStatusEnum.values()){
            if(declareStatus.getValue() == value){
                return declareStatus;
            }
        }
        return null;
    }
}
